package com.project.controller;

import com.project.bean.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("test")
public class TestController {
    //客户端以/tt请求服务器，由该方法处理
    @RequestMapping("/tt")
    public String test(){
        System.out.println("访问到test方法");
        //应用控制器处理完成后，转发指定页面
        return "/html/index.html";
    }
    @RequestMapping("/add")
    public void add(UserBean userBean, HttpServletResponse response)throws Exception{
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().print(userBean);
    }
}
